package io.nick.reqenhance.service;

import io.nick.reqenhance.dto.Test1DTO;
import io.nick.reqenhance.dto.Test2DTO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Nick
 * @date 2019-08-11 13:10
 */
@RestController
@RequestMapping(value = "api")
public class TestService {

  @PostMapping(value = "obj")
  public Test1DTO checkUser(@RequestBody Test1DTO test1DTO) {
    System.out.println(test1DTO.getUserName() + ":" + test1DTO.getAge());
    return test1DTO;
  }

  @PostMapping(value = "vector")
  public List<Test2DTO> checkUser(@RequestBody List<Test2DTO> vec) {
    vec.forEach(System.out::println);
    return vec;
  }
}
